package com.woniuxy.yogaapp.handler;

import lombok.Data;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Data
@Controller
@RequestMapping("/re")
@Scope("prototype")
public class RequestHandler {

	@RequestMapping("/req")
	@ResponseBody
	public Integer getinfo(){
		Subject currentUser = SecurityUtils.getSubject();
		Session session = currentUser.getSession();
		int uid = (int) session.getAttribute("uid");
		System.out.println(uid);
		return  uid;
	}
}
